Skip to main content

All Questions

Tagged with
2votes
1answer
128views

Find ALL duplicate subtrees. using recursion

This is just a practice exercise, I'm trying to understand dynamic programming as deeply as I can. I solved this using recursion, though I am not sure if it will always work. If anyone could tell me a ...
beatmaister's user avatar
2votes
1answer
200views

Implementation of binary tree traversal

Based on what i understood of Binary Tree, queue and recursion I implemented this Breadth First Search algorithm as follows. Do you have any suggestions to improve (in term of readability, good ...
curious's user avatar
2votes
2answers
216views

Lowest Common Ancestor in Binary Tree (Iterative)

In the below code I've implemented a method to find the lowest common ancestor of a binary tree. This is an iterative approach using this pseudocode. Please suggest any improvements that can be made. <...
Saurabh's user avatar
1vote
1answer
216views

Best way to store the sum of all node depths?

To sum up all the nodes' depths in any given binary tree, I've written the following recursive algorithm: ...
thehorsetrack2001's user avatar
5votes
1answer
143views

AVL Tree implementation Based on VisualGo

I have tried implementing an AVL Tree on my own, based on visualising it. But i'm unsure how many testcases it work with, and how efficient it is. Are there any ways to make it efficient, and compact? ...
Anonymous's user avatar

close